﻿

namespace BackupLib.Remoting
{
    using System;

    public abstract class ServiceSettings
    {
        public static BackupProject BackupProject { get; set; }
        public static DateTime NextExecution { get; set; }
        public static event EventHandler<BackupFileEventArgs> OnFile;
        public static event EventHandler<BackupEventArgs> OnStart;
        public static event EventHandler<BackupFinishedEventArgs> OnStop;
        public static bool IsProcessing { get; set; }

        internal static void ClearEventHandlers()
        {
            OnFile = null;
            OnStart = null;
            OnStop = null;
        }

        public static void BackupProject_OnFile(object sender, BackupFileEventArgs e)
        {
            if (OnFile != null)
                OnFile(null, e);
        }
        public static void BackupProject_OnStart(object sender, BackupEventArgs e)
        {
            IsProcessing = true;
            if (OnStart != null)
                OnStart(null, e);
        }
        public static void BackupProject_OnStop(object sender, BackupFinishedEventArgs e)
        {
            IsProcessing = false;
            if (OnStop != null)
                OnStop(null, e);
        }
    }
}
